Wait
Polling helpers for waiting on a condition of the process image.
The overloads taking a Platform sleep on it between polls; the ones without sleep on the default (std::thread-backed) platform and so exist only on hosted runtimes.
- Example
-
bool waitWithPlatform(Robotiq::Gripper& gripper, uint8_t target){bool settled = Robotiq::waitFor([&] { return gripper.getStatus().positionRequestEcho == target; },gripper.platform(),std::chrono::seconds(1));return settled;}
Members
| Functions | |
| bool | waitUntil (Predicate predicate, Platform &platform, std::chrono::steady_clock::time_point deadline, std::chrono::milliseconds pollPeriod=std::chrono::milliseconds(2)) |
|
Poll predicate until it holds, or deadline passes. More... | |
| bool | waitFor (Predicate predicate, Platform &platform, std::chrono::milliseconds timeout, std::chrono::milliseconds pollPeriod=std::chrono::milliseconds(2)) |
|
Poll predicate until it holds, or timeout elapses. More... | |
| bool | waitUntil (Predicate predicate, std::chrono::steady_clock::time_point deadline, std::chrono::milliseconds pollPeriod=std::chrono::milliseconds(2)) |
| bool | waitFor (Predicate predicate, std::chrono::milliseconds timeout, std::chrono::milliseconds pollPeriod=std::chrono::milliseconds(2)) |
Functions
waitFor()
|
Poll predicate until it holds, or timeout elapses.
- Template Parameters
-
Predicate A callable taking no arguments, returning bool.
- Parameters
-
predicate The condition to wait for.
platform Supplies the sleep between polls.
timeout How long to wait, starting now.
pollPeriod How long to sleep between polls.
- Returns
true if predicate held within timeout; false on timeout.
waitFor()
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sleeps on the default (std::thread-backed) platform. Hosted-only.
waitUntil()
|
Poll predicate until it holds, or deadline passes.
predicate is evaluated at least once, even past the deadline: an already-true condition never reports a timeout.
- Template Parameters
-
Predicate A callable taking no arguments, returning bool.
- Parameters
-
predicate The condition to wait for.
platform Supplies the sleep between polls.
deadline The time point past which waiting gives up.
pollPeriod How long to sleep between polls.
- Returns
true if predicate held before deadline; false on timeout.
waitUntil()
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sleeps on the default (std::thread-backed) platform. Hosted-only.
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.